/**
 * 菜单表单
 */
import { ref } from 'vue'
import { FormItemProps } from '../../../components/base/form-item/props/index'
import { menu } from '../../../entity/system/menu'
export const formItems = ref<Array<FormItemProps<menu>>>([
  {
    type: 'input',
    name: 'name',

    label: '菜单名称',
    placeholder: '菜单名称',
    rules: [{ required: true, message: '请输入菜单名称' }],
  },
  {
    type: 'select',
    name: 'type',
    label: '菜单类型',
    placeholder: '菜单类型 在具体按钮上配置权限',
    params: {
      options: [
        {
          value: 0,
          label: '目录',
        },
        {
          value: 1,
          label: '菜单',
        },
      ],
    },
    rules: [{ required: true, message: '请选择菜单类型' }],
  },
  {
    type: 'select',
    name: 'endpoint',
    label: '菜单显示端',
    placeholder: '菜单显示端',
    value: 0,
    params: {
      options: [
        {
          value: 0,
          label: '管理端',
        },
        {
          value: 1,
          label: '用户端',
        },
      ],
    },
  },
  {
    type: 'cascader',
    name: 'parentId',
    placeholder: '父菜单',
    label: '父菜单',
    params: {
      options: [],
      fieldNames: {
        label: 'name',
        value: 'id',
        children: 'children',
      },
      changeOnSelect: true,
    },
  },
  {
    type: 'input',
    name: 'url',
    label: '菜单URL',
    placeholder: '菜单URL',
  },
  {
    type: 'input',
    name: 'icon',
    label: '菜单图标',
    placeholder: '菜单图标',
  },
  {
    type: 'input',
    name: 'perms',
    placeholder: '多个用逗号分隔，如：新增-sys:user:add,修改-sys:user:update',
    label: '权限',
    params: {
      type: 'textarea',
    },
  },
  {
    type: 'input',
    name: 'orderNum',
    label: '排序编号(升序)',
    placeholder: '升序',
  },
])
